{% extends "base.html" %}
{% block content_header %}
<h1>{{ device.device_name }}</h1>
{% endblock %}
{% block content_body %}
{% with messages = get_flashed_messages() %}
{% if messages %}
<div class="callout callout-warning">
    <ul>
        {% for message in messages %}
        <li><h4>{{ message }}</h4></li>
        {% endfor %}
    </ul>
</div>
{% endif %}
{% endwith %}
    <div class="box">
            <div class="box-header">
              <h3 class="box-title">设备配置</h3>
            </div>
    <div class="box-body table-responsive">
        <table class="table table-striped">
            <tr>
                                <th>ID</th>
                <th>配置编码</th>
                <th>配置名称</th>
                <th>配置值</th>
            </tr>
            {% for devicecfg in device_config_list %}
           <tr>
               <td>{{  devicecfg.id   }}</td>
              <td>{{ devicecfg.config_name   }}</td>
               <td>{{  devicecfg.config_code   }}</td>
               <td>{{  devicecfg.config_value   }}</td>
           </tr>
            {% endfor %}
        </table>
             <a class="btn btn-app" data-toggle="modal" data-target="#devicecfg-create-modal"><i class="fa fa-plus"></i>添加配置</a>
    </div>
    </div>
     <div class="modal fade" role="dialog" id="devicecfg-create-modal">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <form action="/devicecfg/create" method="post">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true">×</span></button>
                        <h4 class="modal-title">添加配置</h4>
                    </div>

                    <div class="modal-body">
                    <input type="hidden" name="device_id" id="device_id" value="{{ device.id }}"/>
                        <div class="form-group">
                            <label for="config_name">配置名称</label>
                            <input type="text" name="config_name" id="config_name" class="form-control"
                                   placeholder="配置名称 分辨率">
                        </div>
                                    <div class="form-group">
                            <label for="config_code">配置编码</label>
                            <input type="text" name="config_code" id="config_code" class="form-control"
                                   placeholder="配置编码">
                        </div>

                                    <div class="form-group">
                            <label for="config_value">配置值</label>
                            <input type="text" name="config_value" id="config_value" class="form-control"
                                   placeholder="分辨率X 1980">
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default pull-left" data-dismiss="modal">关闭</button>
                        <button type="submit" class="btn btn-primary">添加</button>
                    </div>
                </form>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->

    </div>
{% endblock %}

